import settings
import os
from fastapi.staticfiles import StaticFiles
from fastapi.middleware.cors import CORSMiddleware
# from routers.catalog import router as catalog_router
from routers.upload.upload_router import router as upload_router
from routers.download.download_router import router as download_router
from routers.video.video_router import router as video_router
from routers.controller.router import router as controller_router
from routers.test import router as test_router
from swagger import app

app.mount('/static', StaticFiles(directory=os.environ.get('static_dir')), name='static')

# app.add_middleware(
#     CORSMiddleware,
#     allow_origins=['*'],
#     allow_methods=["*"],
#     allow_headers=["*"],
# )

app.include_router(download_router)
app.include_router(upload_router)
app.include_router(test_router)
app.include_router(video_router)
app.include_router(controller_router)

@app.get('/')
async def index():
    return 'Hello'

# @app.on_event('shutdown')
# def close_app():
#     print('Server closed')

if __name__ == '__main__':
    import uvicorn
    uvicorn.run(app,port=8001)
    

